package com.freesid.ask.client.field;

import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.XMLParser;

/**
 * 
 * @author jkyang
 *
 */
public class BaseField extends Field {

	private Integer id;

	private Integer order;

	private String name;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getOrder() {
		return order;
	}

	public void setOrder(Integer order) {
		this.order = order;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * <root>	
	 * 		<id>1</id>
	 * 		<name>test</name>
	 * </root> 
	 * @return
	 */
	@Deprecated
	public Element getXml() {
		Document doc = XMLParser.createDocument(); 
		Element root = doc.createElement("root");
		
		Element id = doc.createElement("id");
		id.appendChild(doc.createTextNode(getId().toString()));
		root.appendChild(id);
		
		Element name = doc.createElement("name");
		name.appendChild(doc.createTextNode(this.getName()));
		root.appendChild(name);
		return root;
	}
	
}
